<%@ page import="java.util.List" %>
<%@ page import="net.zjitc.service.BookService" %>
<%@ page import="net.zjitc.service.BookServiceImpl.BookServiceImpl" %>
<%@ page import="net.zjitc.daomain.Book" %><%--
  Created by IntelliJ IDEA.
  User: hasee
  Date: 2017/10/12
  Time: 21:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>图书列表</title>
</head>
<body>
<%
    BookService bookService = new BookServiceImpl();
    List<Book> list = bookService.findAll();
    String str = "";

    for (Book book:list) {
        str =str + book.getId() +"    "+ book.getName();
        str =str + "<a href=\"/web/addServlet?id="+book.getId()+"\">加入购物车</a>" + "</br>";
    }
%>
<form action="/addServlet">
    <table>
        <tr>
            <td>图书列表:</td>
        </tr>
        <tr>
            <td>
                <%= str%>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
